package us.gaaoc.framework.webapp.backingbeans.viewOnly;

 
import java.util.List;
import java.util.Map;

import javax.faces.context.FacesContext;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;

import us.gaaoc.framework.businessmodel.Filing;
import us.gaaoc.framework.webapp.backingbeans.BaseBackingBean;
 
/**
 * 
 * @author hea
 * @date Apr 19, 2006
 * @version: GAJE 1.5
 *
 */
@SuppressWarnings("unchecked")
public class NonServedFilingPage extends BaseBackingBean{

	/**
	 * Properties
	 */
	
	/** Generated Serial Version UID */
	private static final long serialVersionUID = -8911076704420683808L;
	
	private DataModel nonServedFilingDataTable ;

	/**
	 * Constructor
	 *
	 */
	public NonServedFilingPage() {
		//load data   
		//type = childenforcement    status = non-served
		String courtUuid = (String) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("courtUuid");
		List<Filing> newFilings = this.getModelFacade().findCaseFilingsByTypeAndStatus(1,5, courtUuid);	
		nonServedFilingDataTable = new ListDataModel();
		nonServedFilingDataTable.setWrappedData(newFilings);		
	 }

	/**
	 * @return Returns the nonServedFilingDataTable
	 */
	public DataModel getNonServedFilingDataTable() {
		return nonServedFilingDataTable;
	}

	/**
	 * @param nonServedFilingDataTable The nonServedFilingDataTable to set
	 */
	public void setNonServedFilingDataTable(DataModel nonServedFilingDataTable) {
		this.nonServedFilingDataTable = nonServedFilingDataTable;
	}

	/**
	 * This method navigates user to the Case Details Page
	 * @return String
	 */
	public String gotoCaseDetailPage(){
		Map sessionMap = this.getFacesContext().getExternalContext().getSessionMap();
	 	Map requestMap = this.getFacesContext().getExternalContext().getRequestParameterMap();
	 	String caseUuid = ((String) requestMap.get("caseUuid"));
	 	sessionMap.put("caseUuid", caseUuid);
	 	sessionMap.put("from", "NonServedFilingPage");			
		return "gotoCSECaseDetailsPage";
	}
	
	/**
	 * This method navigates user to the Child Enforcement Case Type Page
	 * @return String
	 */
	public String gotoChildEnforcementCaseTypePage() {
		return "gotoChildEnforcementCaseTypePage";
	}
 
	/**
	 * This method navigates user to the History Page
	 * @return
	 */
	public String gotoHistoryPage() {
		Map sessionMap = this.getFacesContext().getExternalContext()
				.getSessionMap();
		Map requestMap = this.getFacesContext().getExternalContext()
				.getRequestParameterMap();
		String caseUuid = ((String) requestMap.get("caseUuid"));
		
		sessionMap.put("caseUuid", caseUuid);
		sessionMap.put("from", "NonServedFilingPage");
		
		return "gotoCaseHistoryPage";
	}
}
